package edu.neu.cs6515.board;

/**
 * Represents a position on a hexagon board
 */
public class BoardCoord {

    /**
     * specifies in which layer a cell is located;
     */
    private final int distance;

    /**
     * specifies the exact placement of the cell within the layer, counting in a
     * clockwise fashion starting from the "northern-most" cell
     */
    private final int angle;

    /**
     * C'tor
     * @param distance dist to center (center = 0)
     * @param angle angle of the coord (top = 0)
     */
    public BoardCoord(final int distance, final int angle) {
        this.distance = distance;
        this.angle = angle;
    }

    public int getDistance() {
        return distance;
    }

    public int getAngle() {
        return angle;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + angle;
        result = prime * result + distance;
        return result;
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        BoardCoord other = (BoardCoord) obj;
        if (angle != other.angle) {
            return false;
        }
        if (distance != other.distance) {
            return false;
        }
        return true;
    }

}
